// src/api/vos/activityfailednumbers.ts
import request from '@/config/axios'
import type {Dayjs} from 'dayjs'

export interface ActivityFailedNumbers {
    id: number
    taskId?: number
    number?: string
    index?: number
    numberMd5: string
    tag: string
    errorMessage: string
}

export const ActivityFailedNumbersApi = {
    getActivityFailedNumbersPage: async (params: any) => {
        return await request.get({url: `/vos/activity-failed-numbers/page`, params})
    },
    getActivityFailedNumbers: async (id: number) => {
        return await request.get({url: `/vos/activity-failed-numbers/get?id=` + id})
    },
    createActivityFailedNumbers: async (data: ActivityFailedNumbers) => {
        return await request.post({url: `/vos/activity-failed-numbers/create`, data})
    },
    updateActivityFailedNumbers: async (data: ActivityFailedNumbers) => {
        return await request.put({url: `/vos/activity-failed-numbers/update`, data})
    },
    deleteActivityFailedNumbers: async (id: number) => {
        return await request.delete({url: `/vos/activity-failed-numbers/delete?id=` + id})
    },
    deleteActivityFailedNumbersList: async (ids: number[]) => {
        return await request.delete({url: `/vos/activity-failed-numbers/delete-list?ids=${ids.join(',')}`})
    },
    exportActivityFailedNumbers: async (params) => {
        return await request.download({url: `/vos/activity-failed-numbers/export-excel`, params})
    },

    /** ★ 新增：通过 taskId 获取分页（便捷方法） */
    getActivityFailedNumbersPageByTaskId: async (taskId: number, pageNo = 1, pageSize = 10) => {
        return await request.get({
            url: `/vos/activity-failed-numbers/page`,
            params: {taskId, pageNo, pageSize}
        })
    }
}
